package com.doghome.mysb.utils;

import java.util.HashMap;

public class AjaxResult extends HashMap<String, Object>{

	/**
	 * 
	 */
	private static final long serialVersionUID = 7894816045002775848L;

	private AjaxResult(int code,String msg) {
		this.put("code", code);
		this.put("msg", msg);
	}
	
	public static AjaxResult success() {
		return new AjaxResult(200, "成功");
	}
	
	public static AjaxResult error() {
		return new AjaxResult(500, "错误");
	}
	
	public static AjaxResult error(int code,String msg) {
		return new AjaxResult(code, msg);
	}
	
	public AjaxResult add(String key,Object val) {
		this.put(key, val);
		return this;
	}
}
